Websydian v6.1 online documentationOnline documentation - WebsydianExpress v3.5

ExtJS Grid Page Functionality

Introduction

Compared to standard Websydian, the way grid pages works has been changed significantly in the Ext JS for WebsydianExpress frameswork. This document provides a detailed explanation of this functionality.

The functions that implement this functionality all inherit from ExtWebGridPage - either directly or through abstract functions that inherit from ExtWebGridPage (e.g. ExtWebDropDown).

In standard Websydian, the grid PageGenerator reads the HTML template - and when the <!-- /(Grid) --> marker is reached, it will start retrieving the grid records, which would then be returned as part of the HTTP response generated by the PageGenerator.

In the Ext JS framework, this behavior has been significantly changed - now the first call to the PageGenerator will return JavaScript that creates an Ext JS grid control on the page. This control will then send it's own HTTP request for data.

We have chosen to let the ExtGridPageGenerator be called for both of these HTTP requests - as this enables you to have the same definitions for an EXTWebGridPage as you would for a standard WebGridPage.

However, even though the Plex definitions are the same as you would create for a standard Websydian GridPageGenerator, the developer needs to be aware of the changed behavior to be able to diagnose any problems that occur when implementing functions that inherit from ExtWebGridPage.

Functionality

The following diagram shows the basic behavior of the ExtWebGridPage and the rest of the functions used when loading the grid.


Loading the ExtWebGridPage

Detailed description

1. Initial request is sent to WebsydianExpress

2. ProcessEntryPoint calls ExtWebGridPageGenerator

3. Ext JS renders the grid and sends a request for the data

4. LoadData eventhandler calls the ExtWebGridPageGenerator

5. Ext JS loads and renders the data into the grid

Considerations

For developers, the first thing to note of is that the base definitions in Plex hasn't changed at all. Both the details and the grid fields are defined in the ExtWebGridPageGenerator - as WsyDetails and WsyGrid fields - just as in standard Websydian.

The use and replacement of views and BlockFetch functions for the ExtWebGridPageGenerator function is also exactly the same as in standard Websydian. With the one important difference: To support the way the grid loads more data when you scroll down your BlockFetch function must inherit from either DataAccessRRN.Fetch.BlockFetchRRNWrapper or RRNEntityRelationalTable.Fetch.WsyStatelessBlockFetchRRN.

The main change you need to consider when developing is if you enter handling of the detail region that should only be performed once for each load of the page.

As described above, the ExtWebGridPageGenerator will be called twice when the page is loaded. If you for instance have a counter that should be incremented each time a user loads a page, you must ensure that this only happens on the first call - or the amounts will be doubled.

You can distinguish between the two calls by checking on the local field Document<ResponseType>. This is populated using the response type that was written to meory by the ProcessEntryPoint or the EventHandler. It is possible that the response type for the first call can have another value than EXTJS, but the second call will always have the value JSON. So if you have functionality that should only be performed on the first call, you should perform this in a conditional block that is performed when Document<ResponseType> is not equal to <ResponseType.EXTJS>.

The one situation where the new functionality will have the highest impact is when debugging. You must be aware of the fact that the function will be called twice - and that it may be processed in two separate jobs/processes - or the behavior you see will be hard/impossible to understand.

Loading additional grid records

The diagram and detailed steps description above describes the initial load of the page and the grid data. As for most standard Websydian grids, the entire content of the grid is not loaded when the page is first loaded.

In standard Websydian, the page would contain a "Next" event that would be used to retrieve the next set of records to show in the list. Pressing Next would reload the entire page.

In the ExtWebGridPage functions, this behavior is also changed - but mostly in the client (browser) part. The "Next" event no longer exists - so there no longer is a "Next" button on the page.

Instead the grid control has a scrollbar that is shown if there are more data in the grid than can be seen on the page. When you scroll down, and nearly reaches the end of the data shown, the grid component will automatically request more data - and steps 7 to 13 in the detailed description will be performed again.

Only the grid content is loaded when more data has been retrieved - the page itself is not reloaded.

Sorting grid records

The Ext JS grid component contains functionality to sort the content of the grid without retrieving the records again from the backend system. This means that this possibility also is available in the implementation of the grid control used by the WebsydianExpress Ext JS framework. However, it is important to note that the sort only is performed on the records already loaded to the grid.